<html>
<head>
    <title>trayDemo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body >
<h1>Tray 测试</h1>
<script>
    var isShowWindow = true;
    // Load native UI library
    var gui = require('nw.gui');
    var win = gui.Window.get();
    var tray = new gui.Tray({ title: '玄魂的软件', icon: '2655716405282662783.png' });
    tray.tooltip = '点此打开';
    //添加一个菜单
    var menu = new gui.Menu();
    menu.append(new gui.MenuItem({ type: 'checkbox', label: '选择我' }));
    tray.menu = menu;
    //click事件
    tray.on('click', function() {
        if(isShowWindow)
        {
            win.hide();
            isShowWindow = false;
        }
        else
        {
            win.show();
            isShowWindow = true;
        }
    });
</script>
</body>
</html>